<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>

<body>
<script>

var r = new RegExp("a","gi");	// 设置匹配模式为全局匹配，且不区分大小写
var s = "javascript!=JAVA";	// 字符串直接量
var a = s.match(r); 			// 匹配查找
alert(a); 						// 返回数组["a","a","A","A"]




</script>
</body>
</html>
